package org.example.erp.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

/**
 * 物料产品管理表
 * @TableName product_material_management
 */
@TableName(value ="product_material_management")
@Data
public class ProductMaterialManagement implements Serializable {
    /**
     * 物料产品编号
     */
    @TableId(type = IdType.AUTO)
    private Integer materialNo;

    /**
     * 物料产品编码
     */
    private String materialProductCode;

    /**
     * 物料产品名称
     */
    private String productName;

    /**
     * 规格型号
     */
    private String specificationAndModel;

    /**
     * 单位
     */
    private Integer unitId;

    /**
     * 物料分类id
     */
    private Integer materialId;

    /**
     * 状态
     */
    private String status;

    /**
     * 设置安全库存
     */
    private String setSafetyStock;

    /**
     * 创建时间
     */

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date creationTime;

    /**
     * 单位名称
     */
    @TableField(exist = false)
    private String unitName;
    /**
     * 分类名称
     */
    @TableField(exist = false)
    private String materialName;
    /**
     * 物料产品标识
     */
    @TableField(exist = false)
    private String  material;

    @TableField(exist = false)
    private List<ProductBom> boms;


    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        ProductMaterialManagement other = (ProductMaterialManagement) that;
        return (this.getMaterialNo() == null ? other.getMaterialNo() == null : this.getMaterialNo().equals(other.getMaterialNo()))
            && (this.getMaterialProductCode() == null ? other.getMaterialProductCode() == null : this.getMaterialProductCode().equals(other.getMaterialProductCode()))
            && (this.getProductName() == null ? other.getProductName() == null : this.getProductName().equals(other.getProductName()))
            && (this.getSpecificationAndModel() == null ? other.getSpecificationAndModel() == null : this.getSpecificationAndModel().equals(other.getSpecificationAndModel()))
            && (this.getUnitId() == null ? other.getUnitId() == null : this.getUnitId().equals(other.getUnitId()))
            && (this.getMaterialId() == null ? other.getMaterialId() == null : this.getMaterialId().equals(other.getMaterialId()))
            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
            && (this.getSetSafetyStock() == null ? other.getSetSafetyStock() == null : this.getSetSafetyStock().equals(other.getSetSafetyStock()))
            && (this.getCreationTime() == null ? other.getCreationTime() == null : this.getCreationTime().equals(other.getCreationTime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getMaterialNo() == null) ? 0 : getMaterialNo().hashCode());
        result = prime * result + ((getMaterialProductCode() == null) ? 0 : getMaterialProductCode().hashCode());
        result = prime * result + ((getProductName() == null) ? 0 : getProductName().hashCode());
        result = prime * result + ((getSpecificationAndModel() == null) ? 0 : getSpecificationAndModel().hashCode());
        result = prime * result + ((getUnitId() == null) ? 0 : getUnitId().hashCode());
        result = prime * result + ((getMaterialId() == null) ? 0 : getMaterialId().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        result = prime * result + ((getSetSafetyStock() == null) ? 0 : getSetSafetyStock().hashCode());
        result = prime * result + ((getCreationTime() == null) ? 0 : getCreationTime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", materialNo=").append(materialNo);
        sb.append(", materialProductCode=").append(materialProductCode);
        sb.append(", productName=").append(productName);
        sb.append(", materialName=").append(materialName);
        sb.append(", specificationAndModel=").append(specificationAndModel);
        sb.append(", unitId=").append(unitId);
        sb.append(", materialId=").append(materialId);
        sb.append(", status=").append(status);
        sb.append(", setSafetyStock=").append(setSafetyStock);
        sb.append(", creationTime=").append(creationTime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}